import { PageParams, PageResult } from '../types/global'
import { BannerItem, CategoryItem, GuessItem, HotItem } from '../types/home'
import { http } from '../utils/http'

/**
 * 首页-广告区域
 * @param distributionSite - 分发站点
 * @returns 广告区域数据
 */
export const getHomeBannerAPI = (distributionSite: number) => {
  return http<BannerItem[]>({
    url: '/home/banner',
    method: 'GET',
    data: {
      distributionSite,
    },
  })
}

/**
 * 首页-前台分类-小程序
 */
export const getHomeCategoryAPI = () => {
  return http<CategoryItem[]>({
    method: 'GET',
    url: '/home/category/mutli',
  })
}

/**
 * 首页-热门推荐-小程序
 */
export const getHomeHotAPI = () => {
  return http<HotItem[]>({
    method: 'GET',
    url: '/home/hot/mutli',
  })
}

export const getHomeGoodsGuessLikeAPI = (params: PageParams) => {
  return http<PageResult<GuessItem>>({
    method: 'GET',
    url: '/home/goods/guessLike',
    data: params,
  })
}
